﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;

public partial class Site : System.Web.UI.Page
{
    protected double maxTrafficSent;
    protected double maxTrafficGet;

    protected double maxScalar;

    protected void Page_Load(object sender, EventArgs e)
    {
        System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["statisticsConnectionString"].ConnectionString);
        conn.Open();

        System.Data.SqlClient.SqlCommand sql = new System.Data.SqlClient.SqlCommand("SELECT MAX(TrafficHTTPSent) FROM Traffic WHERE SiteId = " + this.Request.Params["site"].ToString() + " AND DATEPART(MONTH, Date) = DATEPART(MONTH, '01.03.2010') AND DATEPART(YEAR, Date) = DATEPART(YEAR, '01.03.2010')", conn);
        maxTrafficSent = double.Parse(sql.ExecuteScalar().ToString());

        sql = new System.Data.SqlClient.SqlCommand("SELECT MAX(TrafficHTTPGet) FROM Traffic WHERE SiteId = " + this.Request.Params["site"].ToString() + " AND DATEPART(MONTH, Date) = DATEPART(MONTH, '01.03.2010') AND DATEPART(YEAR, Date) = DATEPART(YEAR, '01.03.2010')", conn);
        maxTrafficGet = double.Parse(sql.ExecuteScalar().ToString());

        maxScalar = maxTrafficGet > maxTrafficSent ? maxTrafficGet : maxTrafficSent;

        conn.Close();
    }
}
